<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/dute_favicon_32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/dute_favicon_16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="manifest" href="/images/manifest.json">
  <meta name="msapplication-config" content="/images/browserconfig.xml">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <meta name="google-site-verification" content="mpI5dkydstZXl6UcDCppqktXK0bbvqdZ6LkZ3KNk4Iw">
  <meta name="baidu-site-verification" content="code-a1LksZX2Ds">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"whitestore.top","root":"/","scheme":"Gemini","version":"7.8.0","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="ElasticSearch Linux 安装教程">
<meta property="og:type" content="article">
<meta property="og:title" content="【ElasticSearch】ElasticSearch Linux 安装教程">
<meta property="og:url" content="https://whitestore.top/2020/08/29/note24/index.html">
<meta property="og:site_name" content="爱看书的阿东">
<meta property="og:description" content="ElasticSearch Linux 安装教程">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-08-29T15:13:52.000Z">
<meta property="article:modified_time" content="2023-07-16T06:28:09.230Z">
<meta property="article:author" content="阿东">
<meta property="article:tag" content="ElasticSearch">
<meta property="article:tag" content="Linux安装教程">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://whitestore.top/2020/08/29/note24/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>【ElasticSearch】ElasticSearch Linux 安装教程 | 爱看书的阿东</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="爱看书的阿东" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">爱看书的阿东</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">赐他一块白色石头，石头上写着新名</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://whitestore.top/2020/08/29/note24/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="阿东">
      <meta itemprop="description" content="随遇而安">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱看书的阿东">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          【ElasticSearch】ElasticSearch Linux 安装教程
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-08-29 23:13:52" itemprop="dateCreated datePublished" datetime="2020-08-29T23:13:52+08:00">2020-08-29</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-07-16 14:28:09" itemprop="dateModified" datetime="2023-07-16T14:28:09+08:00">2023-07-16</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/ElasticSearch/" itemprop="url" rel="index"><span itemprop="name">ElasticSearch</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2020/08/29/note24/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2020/08/29/note24/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>4.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>4 分钟</span>
            </span>
            <div class="post-description">ElasticSearch Linux 安装教程</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="【ElasticSearch】ElasticSearch-Linux-安装教程"><a href="#【ElasticSearch】ElasticSearch-Linux-安装教程" class="headerlink" title="【ElasticSearch】ElasticSearch Linux 安装教程"></a>【ElasticSearch】ElasticSearch Linux 安装教程</h1><a id="more"></a>

<h2 id="基本步骤"><a href="#基本步骤" class="headerlink" title="基本步骤"></a>基本步骤</h2><ol>
<li><p>安装Jdk环境</p>
<ol>
<li>省略</li>
</ol>
</li>
<li><p>下载官方的es包放在usr目录下</p>
</li>
<li><p>在/usr目录下建立一个文件夹</p>
<p><strong>注意这里不能使用root用户进行安装！！！</strong></p>
<p><strong>注意这里不能使用root用户进行安装！！！</strong></p>
<p><strong>注意这里不能使用root用户进行安装！！！</strong></p>
<ol>
<li><p>groupadd elsearch</p>
</li>
<li><p>useradd elsearch -g elsearch</p>
<p>//该命令是更改该文件夹下所属的用户组的权限</p>
</li>
<li><p>chown -R elsearch:elsearch elasticsearch-5.6.3</p>
</li>
</ol>
</li>
<li><p>修改config 目录下的yml文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">#配置es的集群名称，默认是elasticsearch，es会自动发现在同一网段下的es，如果在同一网段下有多个集群，就可以用这个属性来区分不同的集群。</span><br><span class="line"></span><br><span class="line">cluster.name: my-es</span><br><span class="line"></span><br><span class="line">\#节点名称</span><br><span class="line"></span><br><span class="line">node.name: node-1  </span><br><span class="line"></span><br><span class="line">\#设置索引数据的存储路径</span><br><span class="line"></span><br><span class="line">path.data: &#x2F;usr&#x2F;export&#x2F;servers&#x2F;data  </span><br><span class="line"></span><br><span class="line">\#设置日志的存储路径</span><br><span class="line"></span><br><span class="line">path.logs: &#x2F;usr&#x2F;export&#x2F;servers&#x2F;logs  </span><br><span class="line"></span><br><span class="line">\#设置当前的ip地址,通过指定相同网段的其他节点会加入该集群中</span><br><span class="line"></span><br><span class="line">network.host: 0.0.0.0</span><br><span class="line"></span><br><span class="line">\#设置对外服务的http端口</span><br><span class="line"></span><br><span class="line">http.port: 9200  </span><br><span class="line"></span><br><span class="line">\#设置集群中master节点的初始列表，可以通过这些节点来自动发现新加入集群的节点</span><br><span class="line"></span><br><span class="line">discovery.zen.ping.unicast.hosts: [&quot;node-1&quot;]</span><br><span class="line"></span><br><span class="line">记得修改下列两条</span><br><span class="line">bootstrap.memory_lock: false</span><br><span class="line">bootstrap.system_call_filter: false</span><br></pre></td></tr></table></figure>

</li>
</ol>
<p>配置elasticsearch 用户以及权限</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p &#x2F;usr&#x2F;export&#x2F;servers&#x2F;data</span><br><span class="line"></span><br><span class="line">mkdir -p &#x2F;usr&#x2F;export&#x2F;servers&#x2F;logs</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">chown -R es:es &#x2F;usr&#x2F;export&#x2F;servers&#x2F;elasticsearch</span><br><span class="line"></span><br><span class="line">chown -R es:es &#x2F;usr&#x2F;export&#x2F;servers&#x2F;data</span><br><span class="line"></span><br><span class="line">chown -R es:es &#x2F;usr&#x2F;export&#x2F;servers&#x2F;logs</span><br></pre></td></tr></table></figure>

<ol>
<li><p>切换用户 su es</p>
</li>
<li><p>集群启动 bin/elasic。</p>
</li>
<li><p><strong>报错！！</strong></p>
<blockquote>
<p>1.[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] 意思是说你的进程不够用了</p>
<p>解决办法 切到root 用户：进入到security目录下的limits.conf；执行命令 在文件的末尾添加下面的参数值：</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"> vim &#x2F;etc&#x2F;security&#x2F;limits.conf</span><br><span class="line">* soft nofile 65536</span><br><span class="line">* hard nofile 131072</span><br><span class="line">* soft nproc 2048</span><br><span class="line">* hard nproc 4096</span><br><span class="line">前面的*符号必须带上，然后重新启动就可以了。执行完成后可以使用命令 ulimit -n 查看进程数</span><br></pre></td></tr></table></figure>

<blockquote>
<p>2.[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 需要修改系统变量的最大值了</p>
<p>解决方案：切换到root用户修改配置sysctl.conf 增加配置值： vm.max_map_count=655360</p>
<p>执行命令 sysctl -p 这样就可以了，然后重新启动ES服务 就可以了</p>
</blockquote>
<blockquote>
<p>3.[3] snamp centerOs6 不支持 snamp 需要在 yml 中修改配置</p>
<p>解决方案</p>
<p>bootstrap.system_call_filter: false</p>
</blockquote>
</li>
</ol>
<h2 id="基本错误处理"><a href="#基本错误处理" class="headerlink" title="基本错误处理"></a>基本错误处理</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">原因：无法创建本地文件问题,用户最大可创建文件数太小</span><br><span class="line"></span><br><span class="line">解决方案：切换到root用户，编辑limits.conf配置文件，  添加类似如下内容：</span><br><span class="line"></span><br><span class="line">vi &#x2F;etc&#x2F;security&#x2F;limits.conf</span><br><span class="line"></span><br><span class="line">添加如下内容: 注意*不要去掉了</span><br><span class="line"></span><br><span class="line">\* soft nofile 65536</span><br><span class="line"></span><br><span class="line">\* hard nofile 131072</span><br><span class="line"></span><br><span class="line">备注：* 代表Linux所有用户名称（比如  hadoop）</span><br><span class="line"></span><br><span class="line">需要保存、退出、重新登录才可生效。</span><br><span class="line">原因：无法创建本地线程问题,用户最大可创建线程数太小</span><br><span class="line"></span><br><span class="line">解决方案：切换到root用户，进入limits.d目录下，修改90-nproc.conf 配置文件。</span><br><span class="line"></span><br><span class="line">vi &#x2F;etc&#x2F;security&#x2F;limits.d&#x2F;90-nproc.conf</span><br><span class="line"></span><br><span class="line">找到如下内容：</span><br><span class="line"></span><br><span class="line">\* soft nproc 1024</span><br><span class="line"></span><br><span class="line">\#修改为</span><br><span class="line"></span><br><span class="line">\* soft nproc 4096</span><br><span class="line">原因：最大虚拟内存太小</span><br><span class="line"></span><br><span class="line">每次启动机器都手动执行下。</span><br><span class="line"></span><br><span class="line">root用户执行命令：</span><br><span class="line"></span><br><span class="line">执行命令：sysctl -w  vm.max_map_count&#x3D;262144</span><br><span class="line">sudo sysctl -w vm.max_map_count&#x3D;262144</span><br><span class="line">查看修改结果命令：sysctl -a|grep  vm.max_map_count  看是否已经修改</span><br><span class="line"></span><br><span class="line">永久性修改策略：</span><br><span class="line"></span><br><span class="line">echo &quot;vm.max_map_count&#x3D;262144&quot; &gt;&gt;  &#x2F;etc&#x2F;sysctl.echo </span><br><span class="line">或者</span><br><span class="line">&#x2F;&#x2F; 拷贝一本临时文件并且覆盖</span><br><span class="line">echo &quot;vm.max_map_count&#x3D;262144&quot; &gt;&gt; &#x2F;tmp&#x2F;system_sysctl.conf</span><br><span class="line">mv &#x2F;tmp&#x2F;system_sysctl.conf &#x2F;etc&#x2F;sysctl.conf</span><br></pre></td></tr></table></figure>

<p>更多问题自行百度解决…</p>
<h2 id="基本命令"><a href="#基本命令" class="headerlink" title="基本命令"></a>基本命令</h2><blockquote>
<p>查看集群状态：localhost:9200/_cat/health?v 查看索引列表：localhost:9200/_cat/indices?v</p>
</blockquote>
<p>添加一个索引: curl -XPUT ‘<span class="exturl" data-url="aHR0cDovL3huLS1JUC13ejJjbTg5Zzo5MjAwL2RlcHQvZW1wbG95ZWUvMzI=" title="http://xn--IP-wz2cm89g:9200/dept/employee/32">http://主机IP:9200/dept/employee/32<i class="fa fa-external-link"></i></span>‘ -d ‘{ “empname”: “emp32”}’</p>
<h3 id="配置重点"><a href="#配置重点" class="headerlink" title="配置重点:"></a>配置重点:</h3><p><strong>centeros 6 版本执行下列方法</strong></p>
<ol>
<li>开放Linux 9200 端口</li>
<li>vi /etc/sysconfig/iptables</li>
<li>加入内容并保存：-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT</li>
<li>/etc/init.d/iptables restart</li>
<li>/sbin/iptables -L -n</li>
</ol>
<h1 id="安装head-插件"><a href="#安装head-插件" class="headerlink" title="安装head 插件"></a>安装head 插件</h1><h3 id="1-解压插件-如果不存在需要安装解压软件"><a href="#1-解压插件-如果不存在需要安装解压软件" class="headerlink" title="1.解压插件 (如果不存在需要安装解压软件)"></a>1.解压插件 (如果不存在需要安装解压软件)</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install zip unzip</span><br></pre></td></tr></table></figure>

<h3 id="2-安装nodeJS支持-执行如下命令"><a href="#2-安装nodeJS支持-执行如下命令" class="headerlink" title="2.安装nodeJS支持,执行如下命令"></a>2.安装nodeJS支持,执行如下命令</h3><h2 id="具体参考链接"><a href="#具体参考链接" class="headerlink" title="具体参考链接"></a>具体参考链接</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">1. curl -sL https:&#x2F;&#x2F;rpm.nodesource.com&#x2F;setup_8.x | bash -</span><br><span class="line"></span><br><span class="line">2. yum install -y nodejs</span><br><span class="line"></span><br><span class="line">3. npm install grunt --save-dev</span><br><span class="line"></span><br><span class="line">4. 修改head目录下面的 .&#x2F;_site&#x2F;app.js</span><br><span class="line"></span><br><span class="line">   （无法安装请查看nodejs安装教程）</span><br><span class="line">5. npm install phantomjs-prebuilt@2.1.16 --ignore-scripts(必要依赖)</span><br><span class="line"></span><br><span class="line">在 head 根目录下执行: npm run start</span><br><span class="line"></span><br><span class="line">6. 如果连接不上需要执行下列命令</span><br><span class="line">    vi el&#x2F;config&#x2F;elasticsearch.yml</span><br><span class="line">    </span><br><span class="line">    添加如下</span><br><span class="line">    允许远程访问</span><br><span class="line">    http.cors.enabled: true</span><br><span class="line">    http.cors.allow-origin: &quot;*&quot;</span><br></pre></td></tr></table></figure>

<h3 id="3-app-js修改大概位置"><a href="#3-app-js修改大概位置" class="headerlink" title="3.app.js修改大概位置"></a>3.app.js修改大概位置</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">init: function(parent) &#123;</span><br><span class="line">    this._super();</span><br><span class="line">    this.prefs &#x3D; services.Preferences.instance();</span><br><span class="line">    this.base_uri &#x3D; this.config.base_uri || this.prefs.get(&quot;app-base_uri&quot;) || &quot;http:&#x2F;&#x2F;10.215.4.166:9200&quot;;</span><br><span class="line">    if( this.base_uri.charAt( this.base_uri.length - 1 ) !&#x3D;&#x3D; &quot;&#x2F;&quot; ) &#123;</span><br><span class="line">    &#x2F;&#x2F; XHR request fails if the URL is not ending with a &quot;&#x2F;&quot;</span><br><span class="line">    this.base_uri +&#x3D; &quot;&#x2F;&quot;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="4-更换grunt"><a href="#4-更换grunt" class="headerlink" title="4.更换grunt"></a>4.更换grunt</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g yo bower grunt-cli gulp</span><br></pre></td></tr></table></figure>

<h2 id="5-添加索引目录位置"><a href="#5-添加索引目录位置" class="headerlink" title="5.添加索引目录位置"></a>5.添加索引目录位置</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[root@localhost ~]# vi ~&#x2F;.bash_profile</span><br><span class="line"></span><br><span class="line"># .bash_profile</span><br><span class="line"></span><br><span class="line"># Get the aliases and functions</span><br><span class="line"></span><br><span class="line">if [ -f ~&#x2F;.bashrc ]; then</span><br><span class="line">        . ~&#x2F;.bashrc</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line"># User specific environment and startup programs</span><br><span class="line"></span><br><span class="line">PATH&#x3D;$PATH:$HOME&#x2F;bin:&#x2F;usr&#x2F;local&#x2F;src&#x2F;node-v8.2.1-linux-x86&#x2F;bin</span><br></pre></td></tr></table></figure>

<h2 id="6-补充内容"><a href="#6-补充内容" class="headerlink" title="6.补充内容"></a>6.补充内容</h2><blockquote>
<p>现在使用的较多的多半为elasticsearch-head 插件或者自己开发界面以及api接口</p>
</blockquote>
<h3 id="springboot-elasticsearch-部署的配置文件"><a href="#springboot-elasticsearch-部署的配置文件" class="headerlink" title="springboot-elasticsearch 部署的配置文件"></a>springboot-elasticsearch 部署的配置文件</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">spring.data.elasticsearch.cluster-name&#x3D;my-es</span><br><span class="line">#注意： 此处不能和elasticsearch服务一致，因为有可能出现端口攻击问题导致服务器崩溃</span><br><span class="line">spring.data.elasticsearch.cluster-nodes&#x3D;192.168.1.73:9300</span><br><span class="line">spring.data.elasticsearch.repositories.enabled&#x3D;true</span><br></pre></td></tr></table></figure>

<h3 id="接口的注入"><a href="#接口的注入" class="headerlink" title="接口的注入"></a>接口的注入</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">@Component </span><br><span class="line">&#x2F;&#x2F;@Repository</span><br><span class="line">public interface ArticleRepository extends ElasticsearchRepository&lt;Article, Long&gt; &#123;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kity@2.0.4/dist/kity.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text/javascript" src="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.css">
    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>lazytime
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://whitestore.top/2020/08/29/note24/" title="【ElasticSearch】ElasticSearch Linux 安装教程">https://whitestore.top/2020/08/29/note24/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLzQuMC96aC1DTg=="><i class="fa fa-fw fa-creative-commons"></i>BY-NC</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/ElasticSearch/" rel="tag"># ElasticSearch</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/08/29/note23/" rel="prev" title="RocketMq消息队列中间件安装(linux)">
      <i class="fa fa-chevron-left"></i> RocketMq消息队列中间件安装(linux)
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/09/25/note26/" rel="next" title="Mindoc 安装与部署">
      Mindoc 安装与部署 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#【ElasticSearch】ElasticSearch-Linux-安装教程"><span class="nav-number">1.</span> <span class="nav-text">【ElasticSearch】ElasticSearch Linux 安装教程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#基本步骤"><span class="nav-number">1.1.</span> <span class="nav-text">基本步骤</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#基本错误处理"><span class="nav-number">1.2.</span> <span class="nav-text">基本错误处理</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#基本命令"><span class="nav-number">1.3.</span> <span class="nav-text">基本命令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#配置重点"><span class="nav-number">1.3.1.</span> <span class="nav-text">配置重点:</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#安装head-插件"><span class="nav-number">2.</span> <span class="nav-text">安装head 插件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-解压插件-如果不存在需要安装解压软件"><span class="nav-number">2.0.1.</span> <span class="nav-text">1.解压插件 (如果不存在需要安装解压软件)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-安装nodeJS支持-执行如下命令"><span class="nav-number">2.0.2.</span> <span class="nav-text">2.安装nodeJS支持,执行如下命令</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#具体参考链接"><span class="nav-number">2.1.</span> <span class="nav-text">具体参考链接</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-app-js修改大概位置"><span class="nav-number">2.1.1.</span> <span class="nav-text">3.app.js修改大概位置</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#4-更换grunt"><span class="nav-number">2.1.1.1.</span> <span class="nav-text">4.更换grunt</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-添加索引目录位置"><span class="nav-number">2.2.</span> <span class="nav-text">5.添加索引目录位置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-补充内容"><span class="nav-number">2.3.</span> <span class="nav-text">6.补充内容</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#springboot-elasticsearch-部署的配置文件"><span class="nav-number">2.3.1.</span> <span class="nav-text">springboot-elasticsearch 部署的配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#接口的注入"><span class="nav-number">2.3.2.</span> <span class="nav-text">接口的注入</span></a></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">阿东</p>
  <div class="site-description" itemprop="description">随遇而安</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">239</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">36</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">37</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lazyTimes"><i class="fa fa-fw fa-github"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOjEwOTc0ODM1MDhAcXEuY29t" title="E-Mail → mailto:1097483508@qq.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly93d3cuNTJwb2ppZS5jbi9ob21lLnBocD9tb2Q9c3BhY2UmdWlkPTE0OTc3MTgmZG89dGhyZWFkJnZpZXc9bWUmZnJvbT1zcGFjZQ==" title="https:&#x2F;&#x2F;www.52pojie.cn&#x2F;home.php?mod&#x3D;space&amp;uid&#x3D;1497718&amp;do&#x3D;thread&amp;view&#x3D;me&amp;from&#x3D;space">吾爱破解</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uaW0vdXNlci8yOTk5MTIzNDUyNjI2MzY2" title="https:&#x2F;&#x2F;juejin.im&#x2F;user&#x2F;2999123452626366">掘金</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9zZWdtZW50ZmF1bHQuY29tL3UvbGF6eXRpbWVz" title="https:&#x2F;&#x2F;segmentfault.com&#x2F;u&#x2F;lazytimes">思否</span>
        </li>
    </ul>
  </div>

      </div>

      <div class="wechat_OA">
        <span>欢迎关注我的公众号</span>
        <br>
          <!-- 这里添加你的二维码图片 -->
        <img src ="https://adong-picture.oss-cn-shenzhen.aliyuncs.com/adong/wechat_channel.jpg">
      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">阿东</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">2m</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">29:50</span>
</div>
  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & <span class="exturl theme-link" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZw==">NexT.Gemini</span> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : true,
      appId      : 'qMUpEEvBgXaMDD1b0ftgi9xr-gzGzoHsz',
      appKey     : 'UCdfT4Rfih6MO6y8DI4fstf6',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
